home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Entertainment / MacMud / Unix / sys⁄time.h < prev    next >
Encoding:
Text File  |  1989-06-27  |  2.2 KB  |  86 lines  |  [TEXT/????]

  1. /*    @(#)time.h 1.3 86/10/07 SMI; from UCB 6.4 85/06/24    */
  2.  
  3. /*
  4.  * Copyright (c) 1982 Regents of the University of California.
  5.  * All rights reserved.  The Berkeley software License Agreement
  6.  * specifies the terms and conditions for redistribution.
  7.  */
  8.  
  9. #ifndef _TIME_
  10. #define _TIME_
  11.  
  12. /*
  13.  * Structure returned by gettimeofday(2) system call,
  14.  * and used in other calls.
  15.  */
  16. struct timeval {
  17.     long    tv_sec;        /* seconds */
  18.     long    tv_usec;    /* and microseconds */
  19. };
  20.  
  21. struct timezone {
  22.     int    tz_minuteswest;    /* minutes west of Greenwich */
  23.     int    tz_dsttime;    /* type of dst correction */
  24. };
  25. #define    DST_NONE    0    /* not on dst */
  26. #define    DST_USA        1    /* USA style dst */
  27. #define    DST_AUST    2    /* Australian style dst */
  28. #define    DST_WET        3    /* Western European dst */
  29. #define    DST_MET        4    /* Middle European dst */
  30. #define    DST_EET        5    /* Eastern European dst */
  31. #define    DST_CAN        6    /* Canada */
  32. #define    DST_GB        7    /* Great Britain and Eire */
  33. #define    DST_RUM        8    /* Rumania */
  34. #define    DST_TUR        9    /* Turkey */
  35. #define    DST_AUSTALT    10    /* Australian style with shift in 1986 */
  36.  
  37. /*
  38.  * Operations on timevals.
  39.  *
  40.  * NB: timercmp does not work for >= or <=.
  41.  */
  42. #define    timerisset(tvp)        ((tvp)->tv_sec || (tvp)->tv_usec)
  43. #define    timercmp(tvp, uvp, cmp)    \
  44.     ((tvp)->tv_sec cmp (uvp)->tv_sec || \
  45.      (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
  46. #define    timerclear(tvp)        (tvp)->tv_sec = (tvp)->tv_usec = 0
  47.  
  48. /*
  49.  * Names of the interval timers, and structure
  50.  * defining a timer setting.
  51.  */
  52. #define    ITIMER_REAL    0
  53. #define    ITIMER_VIRTUAL    1
  54. #define    ITIMER_PROF    2
  55.  
  56. struct    itimerval {
  57.     struct    timeval it_interval;    /* timer interval */
  58.     struct    timeval it_value;    /* current value */
  59. };
  60.  
  61. /*
  62.  * #include <time.h>   conflict with MPW file of the same name
  63.  */
  64. /*
  65.  * Structure returned by gmtime and localtime calls (see ctime(3)).
  66.  */
  67. struct tm {
  68.         int     tm_sec;
  69.         int     tm_min;
  70.         int     tm_hour;
  71.         int     tm_mday;
  72.         int     tm_mon;
  73.         int     tm_year;
  74.         int     tm_wday;
  75.         int     tm_yday;
  76.         int     tm_isdst;
  77.         char    *tm_zone;
  78.         long    tm_gmtoff;
  79. };
  80.  
  81. extern  struct tm *gmtime(), *localtime();
  82. extern  char *asctime(), *ctime();
  83. extern  void tzset(), tzsetwall();
  84.  
  85. #endif !__TIME_HEADER__
  86.